package com.zbkj.crmeb.store.model;

import java.math.BigDecimal;

import com.alibaba.fastjson.JSONObject;
import com.crmeb.core.annotation.ConvertType;
import com.crmeb.core.annotation.UnitConvert;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

import com.zbkj.crmeb.store.FeatureBaseDO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 商品属性值表
 * </p>
 *
 * @author Mr.Zhang
 * @since 2020-05-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("eb_store_product_attr_value")
@ApiModel(value="StoreProductAttrValue对象", description="商品属性值表")
public class StoreProductAttrValue extends FeatureBaseDO  implements Serializable {
    private static final long serialVersionUID = -3075975004850867199L;

    @ApiModelProperty(value = "attrId")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "商品ID")
    private Integer productId;

    @ApiModelProperty(value = "源SkuId")
    private String sourceSkuId;

    @ApiModelProperty(value = "商品属性索引值 (attr_value|attr_value[|....])")
    private String suk;

    @ApiModelProperty(value = "属性对应的剩余可用库存")
    private Integer stock;

    @ApiModelProperty(value = "属性对应的剩余可用库存")
    @TableField(exist = false)
    private Integer useStock;

    @ApiModelProperty(value = "拼团锁定的库存")
    private Integer groupStock;

    @ApiModelProperty(value = "总库存量")
    private Integer totalStock;

    @ApiModelProperty(value = "销量")
    private Integer sales;

    @ApiModelProperty(value = "属性金额")
    @UnitConvert(ConvertType.PRICE)
    private BigDecimal price;

    @ApiModelProperty(value = "图片")
    private String image;

    @TableField(value = "`unique`")
    @ApiModelProperty(value = "唯一值")
    private String unique;

    @ApiModelProperty(value = "源成本价")
    private BigDecimal sourceCost;

    @ApiModelProperty(value = "成本价")
    @UnitConvert(ConvertType.COST)
    private BigDecimal cost;

    @ApiModelProperty(value = "商品条码")
    private String barCode;

    @ApiModelProperty(value = "原价")
    private BigDecimal otPrice;

    @ApiModelProperty(value = "重量")
    private BigDecimal weight;

    @ApiModelProperty(value = "体积")
    private BigDecimal volume;

    @ApiModelProperty(value = "一级返佣")
    private BigDecimal brokerage;

    @ApiModelProperty(value = "二级返佣")
    private BigDecimal brokerageTwo;

    @ApiModelProperty(value = "活动类型 0=商品，1=秒杀，2=砍价，3=拼团")
    private Integer type;

    @ApiModelProperty(value = "活动限购数量")
    private Integer quota;

    @ApiModelProperty(value = "活动限购数量显示")
    private Integer quotaShow;

    @ApiModelProperty(value = "产品属性值和属性名对应关系")
    private String attrValue;

    @ApiModelProperty(value = "发货地")
    private Integer tempId;

    @ApiModelProperty(value = "供应商自定义skuId")
    private String selfSourceSkuId;

    @ApiModelProperty(value = "扩展参数")
    private String feature;


    @ApiModelProperty(value = "首段物流")
    @TableField(exist = false)
    private BigDecimal firstPrice;

    @ApiModelProperty(value = "二段物流")
    @TableField(exist = false)
    private BigDecimal secondPrice;

    @ApiModelProperty(value = "税费")
    @TableField(exist = false)
    private BigDecimal taxPrice;

    @ApiModelProperty(value = "税费 + 二段物流费用")
    @TableField(exist = false)
    private BigDecimal taxAndSecondPrice;

    @ApiModelProperty(value = "平台加价率")
    @TableField(exist = false)
    private BigDecimal platRatio;

    @ApiModelProperty(value = "加价方式 0：默认分类加价 3：商品加价率 4：原价折扣")
    @TableField(exist = false)
    private Integer markupType;

    @ApiModelProperty(value = "加价率/折扣")
    @TableField(exist = false)
    private BigDecimal priceChange;

    @ApiModelProperty(value = "积分抵扣金额")
    @TableField(exist = false)
    private BigDecimal deductionPrice;

    @ApiModelProperty(value = "商品金额 （售价-积分抵扣金额）")
    @TableField(exist = false)
    private BigDecimal productPaidPrice;

    @ApiModelProperty(value = "使用的积分数")
    @TableField(exist = false)
    private BigDecimal useIntegral;

    @ApiModelProperty(value = "实际支付金额")
    @TableField(exist = false)
    private BigDecimal paidPrice;

    @ApiModelProperty(value = "发货时间")
    @TableField(exist = false)
    private String deliveryTime;

    @ApiModelProperty(value = "收货时间")
    @TableField(exist = false)
    private String receivingTime;

    @ApiModelProperty(value = "子订单总金额")
    @TableField(exist = false)
    private BigDecimal subTotalPrice;

    @ApiModelProperty(value = "季节")
    @TableField(exist = false)
    private String seasonCode;

    @ApiModelProperty(value = "色号")
    @TableField(exist = false)
    private String colorCode;

    @ApiModelProperty(value = "价格尾号")
    @TableField(exist = false)
    private Integer priceTailNumber;

    @ApiModelProperty(value = "一级供应商加价率")
    @TableField(exist = false)
    private BigDecimal firstAgentRatio;

    @ApiModelProperty(value = "一级供应商成本价")
    @TableField(exist = false)
    private BigDecimal firstAgentCost;

    @ApiModelProperty(value = "二级供应商加价率")
    @TableField(exist = false)
    private BigDecimal secondAgentRatio;

    @ApiModelProperty(value = "二级供应商成本价")
    @TableField(exist = false)
    private BigDecimal secondAgentCost;

    @ApiModelProperty(value = "一级服务商id")
    @TableField(exist = false)
    private Integer firstAgentId;

    @ApiModelProperty(value = "二级服务商id")
    @TableField(exist = false)
    private Integer secondAgentId;

    @ApiModelProperty(value = "原始实际支付金额")
    @TableField(exist = false)
    private BigDecimal initialPaidPrice;

    @TableField(exist = false)
    @ApiModelProperty(value = "会员折扣金额")
    private BigDecimal memberDiscountPrice;

    @TableField(exist = false)
    @ApiModelProperty(value = "会员折扣")
    private BigDecimal vipDiscountRatio;

    @TableField(exist = false)
    @ApiModelProperty(value = "秒杀价")
    private BigDecimal spikePrice;

    @ApiModelProperty(value = "活动优惠商品价格")
    @TableField(exist = false)
    private BigDecimal activityProductPrice;

    @ApiModelProperty(value = "付费会员售价")
    @TableField(exist = false)
    private BigDecimal vipPrice;

    @ApiModelProperty(value = "二级会员售价")
    @TableField(exist = false)
    private BigDecimal v2Price;

    @ApiModelProperty(value = "三级会员售价")
    @TableField(exist = false)
    private BigDecimal v3Price;

    @ApiModelProperty(value = "平台加价率")
    @TableField(exist = false)
    private BigDecimal realPlatRatio;

    @ApiModelProperty(value = "供应商加价率")
    @TableField(exist = false)
    private BigDecimal suppliersRatio;

    @ApiModelProperty(value = "推送平台关联数据")
    @TableField(exist = false)
    private Relation pushRelation;

    @Override
    protected void resetFeature() {
        feature = JSONObject.toJSONString(getFeatureMap());
    }

    @Override
    protected String getFeatureString() {
        return feature;
    }
}
